Ext.define('extjs6test.view.core.DictEditWindow', {
    extend: 'extjs6test.view.base.BaseEditWindow',
    requires: [
        "extjs6test.view.core.DictItemGrid"
    ],
    alias: 'widget.dictew',
    controller: 'dictmngr',
    formStore: null,
    formRecord: null,
    width: 630,
    title: 'Dict Window',
    initComponent: function () {
        Ext.apply(this, {
            formItems: [
                {
                    xtype: "fieldset",
                    padding: 9,
                    title: 'Dict',
                    layout: 'column',
                    defaults: {
                        xtype: "textfield",
                        margin: '5 10 5 5',
                        columnWidth: .50,
                        minLength: 1,
                        maxLength: 50
                    },
                    items: [
                        {
                            name: "id",
                            fieldLabel: "id",
                            readOnly: true,
                            allowBlank: false
                        },
                        {
                            name: "dictCode",
                            fieldLabel: "Dict Code",
                            allowBlank: false
                        },
                        {
                            name: "dictName",
                            fieldLabel: "Dict Name",
                            allowBlank: false
                        },
                        {
                            name: "dictType",
                            fieldLabel: "Dict Type",
                            xtype: 'combo',
                            allowBlank: false,
                            store: Ext.create('Ext.data.Store', {
                                fields: [
                                    {name: "value"},
                                    {name: "display"}
                                ],
                                data: [
                                    {value: "0", display: "简单"},
                                    {value: "1", display: "树型"}
                                ]
                            }),
                            editable: false,
                            queryMode: "local",
                            valueField: "value",
                            displayField: "display"
                        },
                        {
                            name: "joinTime",
                            fieldLabel: "Join Time",
                            xtype: 'datefield',
                            readOnly: true,
                            format: 'Y-m-d H:i:s',
                            maxLength: 20,
                            allowBlank: true
                        },
                        {
                            name: "isDeleted",
                            fieldLabel: "isDeleted",
                            xtype: 'combo',
                            store: Ext.create("Ext.data.Store", {
                                fields: ["value", "display"],
                                data: [
                                    {value: true, display: "是"},
                                    {value: false, display: "否"}
                                ]
                            }),
                            editable: false,
                            queryMode: "local",
                            valueField: "value",
                            displayField: "display",
                            defaultValue: false,
                            allowBlank: true
                        },
                        {
                            name: "updateTime",
                            fieldLabel: "updateTime",
                            xtype: 'datefield',
                            format: 'Y-m-d H:i:s',
                            readOnly: true,
                            allowBlank: true
                        },
                        {
                            name: "dictDescription",
                            fieldLabel: "dictDescription",
                            maxLength: 200,
                            xtype: 'textarea',
                            columnWidth: 1,
                            allowBlank: true
                        }
                    ]
                },
                {
                    xtype: "fieldset",
                    title: 'Dict Items',
                    layout: 'fit',
                    items: [
                        {
                            xtype: 'panel',
                            layout: 'fit',
                            dockedItems: [
                                {
                                    dock: 'bottom', xtype: 'toolbar', items: [
                                    '->',
                                    {name: 'addItemBtn', handler: "onAddItem", iconCls: 'x-fa fa-plus'},
                                    {
                                        name: "removeItemBtn",
                                        handler: "onRemoveItem",
                                        iconCls: "x-fa fa-minus"
                                    }
                                ]
                                }
                            ],
                            items: [
                                {
                                    xtype: 'dictitemgrid',
                                    reference: 'itemGrid',
                                    height: 300
                                }
                            ]
                        }
                    ]
                },
                {
                    xtype: 'checkbox',
                    name: 'isContinue',
                    boxLabel: 'Is continue ?'
                }
            ]
        });

        this.callParent(arguments);
    }
});
